def get_inv
  started, inv = false, []
  DownstreamHook.add('inv_check', Proc.new {|i_s|
    started = started || i_s.clean_colors =~ /You are carrying:$/
    if started
      ss = i_s.clean_colors
      if ss =~ Char.prompt
        DownstreamHook.remove('inv_check')
      elsif ss =~ /^[ \(]([ \d]+)[ \)] (.+) \((\d+)\)$/
        inv << {'count'=>[1, $1.strip.to_i].max, 'item'=>$2, 'level'=>$3.to_i}
      end
      nil
    else
      i_s
    end
  })
  $app.connection.send_text('i')
  wait_while(3) {DownstreamHook.list.include?('inv_check')}
  DownstreamHook.remove('inv_check')
  inv
end